<html>
<head><meta charset="utf-8"><title>dyn error handling · project-error-handling · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/index.html">project-error-handling</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html">dyn error handling</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="210805450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805450">(Sep 21 2020 at 21:56)</a>:</h4>
<p>what don't you love about it <span class="user-mention" data-user-id="211722">@Yoshua Wuyts</span> ?</p>



<a name="210805509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805509">(Sep 21 2020 at 21:57)</a>:</h4>
<p>We had to redefine a fair few things (like macros), and there's the pesky problem where this error doesn't implement Error (error containers vs proper errors)</p>



<a name="210805547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805547">(Sep 21 2020 at 21:57)</a>:</h4>
<p>aah yea</p>



<a name="210805600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805600">(Sep 21 2020 at 21:58)</a>:</h4>
<p>the reporters not being able to implement Error issue is lame :/</p>



<a name="210805610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805610">(Sep 21 2020 at 21:58)</a>:</h4>
<p>Not sure if we could avoid the macros; we want to rewrite them to always take a status argument — but the container thing might be more widely applicable</p>



<a name="210805616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805616">(Sep 21 2020 at 21:58)</a>:</h4>
<p>something something chalk fixes this</p>



<a name="210805632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805632">(Sep 21 2020 at 21:58)</a>:</h4>
<p>Oh will it?</p>



<a name="210805641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805641">(Sep 21 2020 at 21:58)</a>:</h4>
<p>maybeee</p>



<a name="210805642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805642">(Sep 21 2020 at 21:58)</a>:</h4>
<p>That's good news!</p>



<a name="210805655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805655">(Sep 21 2020 at 21:58)</a>:</h4>
<p>we might be able to use specialization to resolve the coherence issues</p>



<a name="210805670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805670">(Sep 21 2020 at 21:59)</a>:</h4>
<p>remains to be seen if we'll be able to specialize From impls</p>



<a name="210805679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805679">(Sep 21 2020 at 21:59)</a>:</h4>
<p>as for the macros thing</p>



<a name="210805683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805683">(Sep 21 2020 at 21:59)</a>:</h4>
<p>Oh haha, "maybe chalk fixes this" — I've heard that before</p>



<a name="210805684"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805684" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805684">(Sep 21 2020 at 21:59)</a>:</h4>
<p>Oh haha, "maybe chalk fixes this" — I've heard that before</p>



<a name="210805685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805685">(Sep 21 2020 at 21:59)</a>:</h4>
<p>Fingers crossed</p>



<a name="210805697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805697">(Sep 21 2020 at 21:59)</a>:</h4>
<p>well, i guess first I should ask</p>



<a name="210805705"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805705" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805705">(Sep 21 2020 at 21:59)</a>:</h4>
<p>you dont have anyhow exposed as part of your API right?</p>



<a name="210805717"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805717" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805717">(Sep 21 2020 at 22:00)</a>:</h4>
<p>_assuming its an internal detail_</p>



<a name="210805755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805755">(Sep 21 2020 at 22:00)</a>:</h4>
<p>I believe we have a From impl, so technically yes</p>



<a name="210805782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805782">(Sep 21 2020 at 22:00)</a>:</h4>
<p>unfortunate</p>



<a name="210805783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805783">(Sep 21 2020 at 22:00)</a>:</h4>
<p>Or a from_anyhow method? Lemme check</p>



<a name="210805797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805797">(Sep 21 2020 at 22:00)</a>:</h4>
<p>private trait impls would be nice for this exact problem</p>



<a name="210805902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805902">(Sep 21 2020 at 22:01)</a>:</h4>
<p>Not sure I follow? Which problem?</p>



<a name="210805916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805916">(Sep 21 2020 at 22:02)</a>:</h4>
<p>exposing anyhow as part of your API</p>



<a name="210805963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805963">(Sep 21 2020 at 22:02)</a>:</h4>
<p>i guess thats not really the problem at hand</p>



<a name="210805980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210805980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210805980">(Sep 21 2020 at 22:02)</a>:</h4>
<p>(also can't find the conversion — maybe we don't have it after all! Though I really thought we did..)</p>



<a name="210806004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806004">(Sep 21 2020 at 22:02)</a>:</h4>
<p>its this one <a href="https://docs.rs/http-types/2.4.0/http_types/struct.Error.html#impl-From%3CE%3E">https://docs.rs/http-types/2.4.0/http_types/struct.Error.html#impl-From%3CE%3E</a></p>



<a name="210806011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806011">(Sep 21 2020 at 22:02)</a>:</h4>
<p>they both look like <code>Error</code> so its sneaky</p>



<a name="210806015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806015">(Sep 21 2020 at 22:02)</a>:</h4>
<p>Yeah I was confused; didn't see how those related — but agree it'd be nice for other things for sure!</p>



<a name="210806047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806047">(Sep 21 2020 at 22:03)</a>:</h4>
<p>Ah dang</p>



<a name="210806103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806103">(Sep 21 2020 at 22:04)</a>:</h4>
<p>the macros issue might be kinda resolved by merging the stuff from eyre into anyhow but the way it solves it potentially introduces other problems</p>



<a name="210806161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806161">(Sep 21 2020 at 22:04)</a>:</h4>
<p>the idea being that with a ReportHandler based on eyre in anyhow you could store the status code inside of the <code>anyhow::Error</code> instead of alongside it</p>



<a name="210806180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806180">(Sep 21 2020 at 22:04)</a>:</h4>
<p>so then you'd be able to just directly export <code>anyhow::Error</code> as your error type and you wouldn't have to redefine errors</p>



<a name="210806222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806222">(Sep 21 2020 at 22:05)</a>:</h4>
<p>the hickup being that they _have_ to use the error handler you define, which is installed globally via a <code>set_hook</code> fn, and if they dont you wouldn't have access to status codes</p>



<a name="210806226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806226">(Sep 21 2020 at 22:05)</a>:</h4>
<p>What we want to enable people to write is:</p>
<div class="codehilite"><pre><span></span><code><span class="n">ensure</span><span class="o">!</span><span class="p">(</span><span class="n">user</span><span class="p">.</span><span class="n">is_validated</span><span class="p">(),</span><span class="w"> </span><span class="mi">403</span><span class="p">,</span><span class="w"> </span><span class="s">&quot;Authentication required);</span>
</code></pre></div>



<a name="210806234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806234">(Sep 21 2020 at 22:05)</a>:</h4>
<p>or if they want to use another reporting hook</p>



<a name="210806254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806254">(Sep 21 2020 at 22:05)</a>:</h4>
<p>aah, yea that wouldn't be possible</p>



<a name="210806266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806266">(Sep 21 2020 at 22:05)</a>:</h4>
<p>you'd need to write your own macro for that still</p>



<a name="210806280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806280">(Sep 21 2020 at 22:05)</a>:</h4>
<p>Yeah, that's what I was thinking</p>



<a name="210806357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806357">(Sep 21 2020 at 22:06)</a>:</h4>
<p>Though I'm quite intrigued by Eyre being able to carry metadata</p>



<a name="210806375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806375">(Sep 21 2020 at 22:06)</a>:</h4>
<p>with the eyre changes you'd do something like</p>
<div class="codehilite"><pre><span></span><code><span class="k">if</span><span class="w"> </span><span class="o">!</span><span class="n">user</span><span class="p">.</span><span class="n">is_validated</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="nb">Err</span><span class="p">(</span><span class="n">format_err</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;Authentication required&quot;</span><span class="p">).</span><span class="n">status_code</span><span class="p">(</span><span class="mi">403</span><span class="p">)))</span><span class="o">?</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="210806435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806435">(Sep 21 2020 at 22:07)</a>:</h4>
<p>That's quite nice!</p>



<a name="210806447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806447">(Sep 21 2020 at 22:07)</a>:</h4>
<p>:D</p>



<a name="210806538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806538">(Sep 21 2020 at 22:08)</a>:</h4>
<p>Btw, I'm not the right person to chat about this — but something we've seen come up a lot in Tide is downcasting</p>



<a name="210806550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806550">(Sep 21 2020 at 22:08)</a>:</h4>
<p>Swift recently introduced typed <code>catch</code> which I thought was quite nice</p>



<a name="210806561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806561">(Sep 21 2020 at 22:08)</a>:</h4>
<p>as in tide ends up needing to use downcast instead of <code>match</code>?</p>



<a name="210806563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806563">(Sep 21 2020 at 22:08)</a>:</h4>
<p>Dunno, feel there might be something there</p>



<a name="210806570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806570">(Sep 21 2020 at 22:08)</a>:</h4>
<p>this doesn't surprise me</p>



<a name="210806581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806581">(Sep 21 2020 at 22:09)</a>:</h4>
<p>i think this is a property of a certain style of application framework</p>



<a name="210806586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806586">(Sep 21 2020 at 22:09)</a>:</h4>
<p><code>tower</code> has the same property</p>



<a name="210806589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806589">(Sep 21 2020 at 22:09)</a>:</h4>
<p>which annoys me</p>



<a name="210806594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806594">(Sep 21 2020 at 22:09)</a>:</h4>
<p>because it doesn't actually integrate well with <code>eyre::Report</code></p>



<a name="210806600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806600">(Sep 21 2020 at 22:09)</a>:</h4>
<p>well, if you use certain middlewear that is</p>



<a name="210806620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806620">(Sep 21 2020 at 22:09)</a>:</h4>
<p>It seemed like a choice between boxing and downcasting vs threading even more generics — we chose the former</p>



<a name="210806650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806650">(Sep 21 2020 at 22:10)</a>:</h4>
<p>yea i think thats the right choice personally</p>



<a name="210806685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806685">(Sep 21 2020 at 22:10)</a>:</h4>
<p>imo downcasting as a form of reacting to errors is fine and good</p>



<a name="210806706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806706">(Sep 21 2020 at 22:10)</a>:</h4>
<p>the biggest downside being you don't get an enumerated list of errors in the source code you can easily reference to figure out what you need to handle</p>



<a name="210806716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806716">(Sep 21 2020 at 22:10)</a>:</h4>
<p>It doesn't seem particularly smooth yet tho — haven't thought too much about it, but I feel there is something that could be worth thinking about</p>



<a name="210806720"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806720" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806720">(Sep 21 2020 at 22:10)</a>:</h4>
<p>the upside being that you still never fail to handle errors because you always have to handle the case where its none of the types you downcast too</p>



<a name="210806757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806757">(Sep 21 2020 at 22:11)</a>:</h4>
<p>i think there might be some room for language level support of matching against type erased objects</p>



<a name="210806767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806767">(Sep 21 2020 at 22:11)</a>:</h4>
<p>tho probably initially macro level support</p>



<a name="210806793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806793">(Sep 21 2020 at 22:12)</a>:</h4>
<p>the <code>error</code> crate has some prior art for this</p>



<a name="210806838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806838">(Sep 21 2020 at 22:12)</a>:</h4>
<p><a href="https://docs.rs/error/0.1.9/error/macro.match_error.html">https://docs.rs/error/0.1.9/error/macro.match_error.html</a></p>



<a name="210806850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806850">(Sep 21 2020 at 22:12)</a>:</h4>
<p><a href="https://docs.rs/error/0.1.9/src/error/lib.rs.html#99-115">https://docs.rs/error/0.1.9/src/error/lib.rs.html#99-115</a></p>



<a name="210806863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806863">(Sep 21 2020 at 22:12)</a>:</h4>
<p>im guessing this is much like the <code>catch</code> you mentioned being added to tide</p>



<a name="210806869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806869">(Sep 21 2020 at 22:12)</a>:</h4>
<p>This is the Swift feature btw: "multi pattern catch clauses" <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0276-multi-pattern-catch-clauses.md">https://github.com/apple/swift-evolution/blob/master/proposals/0276-multi-pattern-catch-clauses.md</a></p>



<a name="210806870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806870">(Sep 21 2020 at 22:12)</a>:</h4>
<p>gonna check that out rn actually</p>



<a name="210806898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806898">(Sep 21 2020 at 22:13)</a>:</h4>
<p>cool!</p>



<a name="210806921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806921">(Sep 21 2020 at 22:13)</a>:</h4>
<p>[meta note: not sure if we're still on topic for this stream; we should probably fork this to a new one. No idea how to do that on mobile tho lmao]</p>



<a name="210806926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806926">(Sep 21 2020 at 22:13)</a>:</h4>
<p>is the <code>catch</code> macro you mentioned merged?</p>



<a name="210806934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806934">(Sep 21 2020 at 22:13)</a>:</h4>
<p>yea let me do that</p>



<a name="210806939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210806939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210806939">(Sep 21 2020 at 22:13)</a>:</h4>
<p>Which catch macro?</p>



<a name="210807031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210807031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210807031">(Sep 21 2020 at 22:14)</a>:</h4>
<p><span class="user-mention silent" data-user-id="211722">Yoshua Wuyts</span> <a href="#narrow/stream/257204-project-error-handling/topic/dyn.20error.20handlnig/near/210806550">said</a>:</p>
<blockquote>
<p>Swift recently introduced typed <code>catch</code> which I thought was quite nice</p>
</blockquote>
<p>oh swift</p>



<a name="210807043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210807043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210807043">(Sep 21 2020 at 22:14)</a>:</h4>
<p>i thought you meant you added a macro for handling downcast and match in tide</p>



<a name="210807049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210807049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210807049">(Sep 21 2020 at 22:14)</a>:</h4>
<p>didn't read properly</p>



<a name="210807568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210807568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210807568">(Sep 21 2020 at 22:19)</a>:</h4>
<p>Okay so according to <a href="https://www.hackingwithswift.com/new-syntax-swift-2-error-handling-try-catch">https://www.hackingwithswift.com/new-syntax-swift-2-error-handling-try-catch</a> the catch clause syntax in Swift only applies for enum-style errors</p>



<a name="210807700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210807700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210807700">(Sep 21 2020 at 22:21)</a>:</h4>
<p>Doesn't seem to work for something like downcasting afaict; and even doubt it'd work for "container errors" in the <code>std::io::{Error, ErrorKind}</code> style</p>



<a name="210807801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210807801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210807801">(Sep 21 2020 at 22:22)</a>:</h4>
<p>why not?</p>



<a name="210807802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210807802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210807802">(Sep 21 2020 at 22:22)</a>:</h4>
<p>Still tho — this is pretty interesting and seems like it could be a direction if we ever get to stabilizing try clauses in Rust</p>



<a name="210807807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210807807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210807807">(Sep 21 2020 at 22:22)</a>:</h4>
<p>it seems like you could have something like</p>



<a name="210807887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210807887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210807887">(Sep 21 2020 at 22:24)</a>:</h4>
<div class="codehilite"><pre><span></span><code><span class="n">downcast_match</span><span class="w"> </span><span class="n">err</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">err</span><span class="w"> </span><span class="o">@</span><span class="w"> </span><span class="n">std</span>::<span class="n">io</span>::<span class="n">Error</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="k">match</span><span class="w"> </span><span class="n">err</span><span class="p">.</span><span class="n">kind</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="c1">// ...</span>
<span class="w">    </span><span class="p">},</span><span class="w"></span>
<span class="w">    </span><span class="n">err</span><span class="w"> </span><span class="o">@</span><span class="w"> </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">eprintln</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;Error: {:?}&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">err</span><span class="p">),</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="210807961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210807961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210807961">(Sep 21 2020 at 22:24)</a>:</h4>
<p>you'd need two inputs for each match arm as I see it, the type being downcast too, and the pattern(s) that type is being matched against on a successful downcast</p>



<a name="210807996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210807996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210807996">(Sep 21 2020 at 22:25)</a>:</h4>
<p>extremely strawman syntax but hopefully it gets the idea across</p>



<a name="210808082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808082">(Sep 21 2020 at 22:26)</a>:</h4>
<p>I see</p>



<a name="210808083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gus Wynn <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808083">(Sep 21 2020 at 22:26)</a>:</h4>
<p>Having language support for downcast matching would be phenomenal, where I work we have some common cases that end up with long verbose if let chains</p>



<a name="210808309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808309">(Sep 21 2020 at 22:29)</a>:</h4>
<p>Oh what if there was a <code>catch</code> and a <code>downcast catch</code>. Getting to the inner ErrorKind could even be as short as:</p>
<p>Adapting the Swift syntax we could have:</p>
<div class="codehilite"><pre><span></span><code><span class="k">try</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="p">}</span><span class="w"> </span><span class="n">downcast</span><span class="w"> </span><span class="n">catch</span><span class="w"> </span><span class="n">ErrorKind</span>:: <span class="nc">NonBlocking</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="210808322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808322">(Sep 21 2020 at 22:29)</a>:</h4>
<p>Big ol' straw man too</p>



<a name="210808355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808355">(Sep 21 2020 at 22:30)</a>:</h4>
<p>as in tying the catch syntax to try blocks?</p>



<a name="210808454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808454">(Sep 21 2020 at 22:30)</a>:</h4>
<p>seems like you'd run into issues around the fact that <code>try</code> blocks are about control flow ontop of <code>Result</code> but this proposed <code>catch</code> is for dynamic dispatch based on <code>dyn Error</code> / <code>dyn Any</code></p>



<a name="210808468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808468">(Sep 21 2020 at 22:31)</a>:</h4>
<p>Yeah, I guess I didn't spell that assumption out</p>



<a name="210808525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808525">(Sep 21 2020 at 22:32)</a>:</h4>
<p>Both dynamic dispatch for <code>dyn Error</code> and static matching on Error enums</p>



<a name="210808569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808569">(Sep 21 2020 at 22:32)</a>:</h4>
<p>Though there is definitely a lot to unpack</p>



<a name="210808573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808573">(Sep 21 2020 at 22:32)</a>:</h4>
<p>yea</p>



<a name="210808584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808584">(Sep 21 2020 at 22:32)</a>:</h4>
<p>my preference would be to not tie it to <code>try</code> blocks in any way</p>



<a name="210808586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Gus Wynn <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808586">(Sep 21 2020 at 22:32)</a>:</h4>
<p>Yeah I was gonna say, downcast matching would be super nice to make other non-Error-handling dynamic typing cases better as well</p>



<a name="210808667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808667">(Sep 21 2020 at 22:33)</a>:</h4>
<p>getting equivalent syntax would be pretty easy</p>
<div class="codehilite"><pre><span></span><code><span class="k">try</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="c1">// ...</span>
<span class="p">}.</span><span class="n">map_err</span><span class="p">(</span><span class="o">|</span><span class="n">err</span><span class="o">|</span><span class="w"> </span><span class="n">catch</span><span class="w"> </span><span class="n">err</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">ErrorKind</span>:: <span class="nc">NonBlocking</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="p">},</span><span class="w"></span>
<span class="p">})</span><span class="w"></span>
</code></pre></div>



<a name="210808676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808676">(Sep 21 2020 at 22:34)</a>:</h4>
<p>Perhaps before we can talk about downcast-based error handling we should get a better sense for downcasting in general (and lang facilities for that), but also gather a list of all the ways people construct errors right now</p>



<a name="210808724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808724">(Sep 21 2020 at 22:34)</a>:</h4>
<p>tho i think the error kind special cased syntax woulud also run into issues because theres no standardized interface to kinds based on the error kind pattern</p>



<a name="210808769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808769">(Sep 21 2020 at 22:35)</a>:</h4>
<p>Because off the top of my head it's: boxed dyn errors, enums, one-off structs, structs wrapping enums — but may be missing some</p>



<a name="210808822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808822">(Sep 21 2020 at 22:35)</a>:</h4>
<p>one last strawman syntax</p>
<div class="codehilite"><pre><span></span><code><span class="k">try</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="c1">// ...</span>
<span class="p">}.</span><span class="n">map_err</span><span class="p">(</span><span class="o">|</span><span class="n">err</span><span class="o">|</span><span class="w"> </span><span class="n">downcast</span><span class="w"> </span><span class="n">err</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">std</span>::<span class="n">io</span>::<span class="n">Error</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="n">err</span><span class="p">.</span><span class="n">kind</span><span class="p">()</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">NonBlocking</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="c1">// ... },</span>
<span class="w">    </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="c1">// ... },</span>
<span class="p">})</span><span class="w"></span>
</code></pre></div>



<a name="210808873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808873">(Sep 21 2020 at 22:36)</a>:</h4>
<p>there's also error codes</p>



<a name="210808882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808882">(Sep 21 2020 at 22:36)</a>:</h4>
<p>/me wants exception terminology to be a thing</p>



<a name="210808887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808887">(Sep 21 2020 at 22:36)</a>:</h4>
<p>templated errors</p>



<a name="210808907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808907">(Sep 21 2020 at 22:36)</a>:</h4>
<p><span class="user-mention silent" data-user-id="211722">Yoshua Wuyts</span> <a href="#narrow/stream/257204-project-error-handling/topic/dyn.20error.20handlnig/near/210808882">said</a>:</p>
<blockquote>
<p>/me wants exception terminology to be a thing</p>
</blockquote>
<p>you're in for a rough road on that one I fear <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="210808928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808928">(Sep 21 2020 at 22:36)</a>:</h4>
<p>the community seems pretty biased against exception terminology in my experience</p>



<a name="210808965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808965">(Sep 21 2020 at 22:37)</a>:</h4>
<p>Ha; perhaps I should rephrase — we should own up to the fact that were using exception terminology and embrace it in future designs</p>



<a name="210808999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210808999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210808999">(Sep 21 2020 at 22:38)</a>:</h4>
<p>(deleted)</p>



<a name="210809058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210809058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210809058">(Sep 21 2020 at 22:38)</a>:</h4>
<p>(deleted)</p>



<a name="210817569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210817569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210817569">(Sep 22 2020 at 00:39)</a>:</h4>
<p><span class="user-mention silent" data-user-id="220273">Jane Lusby</span> <a href="#narrow/stream/257204-project-error-handling/topic/dyn.20error.20handling/near/210807887">said</a>:</p>
<blockquote>
<div class="codehilite"><pre><span></span><code><span class="n">downcast_match</span><span class="w"> </span><span class="n">err</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">err</span><span class="w"> </span><span class="o">@</span><span class="w"> </span><span class="n">std</span>::<span class="n">io</span>::<span class="n">Error</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="k">match</span><span class="w"> </span><span class="n">err</span><span class="p">.</span><span class="n">kind</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="c1">// ...</span>
<span class="w">    </span><span class="p">},</span><span class="w"></span>
<span class="w">    </span><span class="n">err</span><span class="w"> </span><span class="o">@</span><span class="w"> </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">eprintln</span><span class="o">!</span><span class="p">(</span><span class="s">&quot;Error: {:?}&quot;</span><span class="p">,</span><span class="w"> </span><span class="n">err</span><span class="p">),</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>


</blockquote>
<p>cc <span class="user-mention" data-user-id="252217">@Khionu Sybiern</span> who I think had an idea like this a while back</p>



<a name="210817587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210817587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210817587">(Sep 22 2020 at 00:39)</a>:</h4>
<p>different syntax though, I forget what it was</p>



<a name="210825558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210825558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jason Smith <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210825558">(Sep 22 2020 at 03:45)</a>:</h4>
<p>What is "exceptions terminology?" Is that like supporting a keyword called "catch," or something different?</p>



<a name="210828088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210828088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210828088">(Sep 22 2020 at 04:53)</a>:</h4>
<p>"throw"<br>
"catch"</p>



<a name="210903368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210903368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Yoshua Wuyts <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210903368">(Sep 22 2020 at 17:22)</a>:</h4>
<p>"try" being the one we already use</p>



<a name="210904221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210904221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210904221">(Sep 22 2020 at 17:28)</a>:</h4>
<p>I thought currently Jane is in favor of <code>try</code> personally but thinks it's unlikely<br>
to gain support generally</p>



<a name="210905309"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210905309" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210905309">(Sep 22 2020 at 17:37)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281739">oliver</span> <a href="#narrow/stream/257204-project-error-handling/topic/dyn.20error.20handling/near/210904221">said</a>:</p>
<blockquote>
<p>I thought currently Jane is in favor of <code>try</code> personally but thinks it's unlikely<br>
to gain support generally</p>
</blockquote>
<p>try as in try blocks is almost certainly going to become part of the language, it's already available on nightly and seems to be on the near horizon, I was referring to the change in terminology, which right now is almost always sold as "not exceptions"</p>
<p>for example, here's a snippet from The Rust Programming Language's chapter on error handling</p>
<blockquote>
<p>Most languages don’t distinguish between these two kinds of errors and handle both in the same way, using mechanisms such as exceptions. <strong>Rust doesn’t have exceptions.</strong></p>
</blockquote>
<p>emphasis mine</p>
<p>My personal opinion is that I'm very in favor of try blocks and I don't much care about whether or not we call recoverable ____s in rust errors or exceptions, but I feel that the ship has already sailed and that it is too late to embrace the idea that recoverable ___s in rust <em>are</em> exceptions. However, I would not object if the majority of the project group and libs team felt otherwise and decided to embrace exception terminology.</p>



<a name="210906037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210906037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210906037">(Sep 22 2020 at 17:42)</a>:</h4>
<p>That gets into what do people expect from the term "exception". Underlying implementation details, keywords like <code>throw</code>, syntax around how it's described, etc.</p>



<a name="210907340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210907340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210907340">(Sep 22 2020 at 17:51)</a>:</h4>
<p>'exception' to me implies classes and unwinding</p>



<a name="210907416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210907416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210907416">(Sep 22 2020 at 17:52)</a>:</h4>
<p>which is not the case in rust, and I think calling them exceptions would get people confused with panics</p>



<a name="210909796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210909796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210909796">(Sep 22 2020 at 18:08)</a>:</h4>
<p>Alright so the <code>try</code> pattern will become stable eventually what remains to<br>
decide is whether or how error handling will be integrated. To what extent are<br>
we restricted by this:<br>
<a href="https://github.com/rust-lang/project-error-handling/blob/master/CHARTER.md#non-goals">https://github.com/rust-lang/project-error-handling/blob/master/CHARTER.md#non-goals</a></p>



<a name="210910060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210910060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210910060">(Sep 22 2020 at 18:10)</a>:</h4>
<blockquote>
<p>will become stable eventually</p>
</blockquote>
<p>There's no guarantee of that, AFAICT. Nothing's stable until it ships.</p>



<a name="210910109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210910109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210910109">(Sep 22 2020 at 18:11)</a>:</h4>
<p><span class="user-mention silent" data-user-id="220273">Jane Lusby</span> <a href="#narrow/stream/257204-project-error-handling/topic/dyn.20error.20handling/near/210905309">said</a>:<br>
try as in try blocks is almost certainly going to become part of the language</p>
<div class="codehilite"><pre><span></span><code>
</code></pre></div>



<a name="210910114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210910114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210910114">(Sep 22 2020 at 18:11)</a>:</h4>
<p><span class="user-mention" data-user-id="281739">@oliver</span> pretty much completely. <code>try</code> blocks and the try trait are used to model control flow, specifically the propagation of fallibility, and they're a language level feature. We're a libs team group focused primarily on how those errors are represented, rather than how they're propagated.</p>



<a name="210910154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210910154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210910154">(Sep 22 2020 at 18:11)</a>:</h4>
<p><span class="user-mention" data-user-id="281739">@oliver</span> that was me speculating, what <span class="user-mention" data-user-id="116155">@Jake Goulding</span> said is correct, there is no guarantee</p>



<a name="210910304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210910304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210910304">(Sep 22 2020 at 18:12)</a>:</h4>
<p>My feeling is that this group isn't going to make any specific decisions that change the language (esp. w.r.t <code>try</code> blocks). We can provide feedback to the appropriate language team about how well (or not) the current / proposed try blocks work in conjunction with current or recommended error handling patterns.</p>



<a name="210910391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210910391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210910391">(Sep 22 2020 at 18:13)</a>:</h4>
<p>I see so we should consider the <code>try</code> pattern but not deliberate on exactly how<br>
it will use error types</p>



<a name="210910506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210910506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210910506">(Sep 22 2020 at 18:14)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281739">oliver</span> <a href="#narrow/stream/257204-project-error-handling/topic/dyn.20error.20handling/near/210910391">said</a>:</p>
<blockquote>
<p>I see so we should consider the <code>try</code> pattern but not deliberate on exactly how<br>
it will use error types</p>
</blockquote>
<p>I think we should not concern ourselves with <code>try</code> blocks at all</p>



<a name="210910538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210910538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210910538">(Sep 22 2020 at 18:14)</a>:</h4>
<p>As a single data point, I've found that try blocks kind of suck to use (to put a fine point on it <span aria-label="innocent" class="emoji emoji-1f607" role="img" title="innocent">:innocent:</span>).</p>



<a name="210910556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210910556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210910556">(Sep 22 2020 at 18:14)</a>:</h4>
<p>we should focus on how errors are represented, how those representations are implemented, how they interoperate, how they're reacted to and reported, etc</p>



<a name="210910679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210910679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210910679">(Sep 22 2020 at 18:15)</a>:</h4>
<p><span class="user-mention silent" data-user-id="220273">Jane Lusby</span> <a href="#narrow/stream/257204-project-error-handling/topic/dyn.20error.20handling/near/210910506">said</a>:</p>
<blockquote>
<p>I think we should not concern ourselves with <code>try</code> blocks at all</p>
</blockquote>
<p>I'd disagree, mostly because I think that <code>try</code>, as part of the language, should be considered as much as <code>match</code> or <code>if let</code> or <code>?</code> in regards to errors.</p>



<a name="210910681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210910681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210910681">(Sep 22 2020 at 18:15)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116155">Jake Goulding</span> <a href="#narrow/stream/257204-project-error-handling/topic/dyn.20error.20handling/near/210910538">said</a>:</p>
<blockquote>
<p>As a single data point, I've found that try blocks kind of suck to use (to put a fine point on it <span aria-label="innocent" class="emoji emoji-1f607" role="img" title="innocent">:innocent:</span>).</p>
</blockquote>
<p>Agreed, it's always a pain knowing if one is catching the right thing</p>



<a name="210910700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210910700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210910700">(Sep 22 2020 at 18:15)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116155">Jake Goulding</span> <a href="#narrow/stream/257204-project-error-handling/topic/dyn.20error.20handling/near/210910538">said</a>:</p>
<blockquote>
<p>As a single data point, I've found that try blocks kind of suck to use (to put a fine point on it <span aria-label="innocent" class="emoji emoji-1f607" role="img" title="innocent">:innocent:</span>).</p>
</blockquote>
<p>lets hope the lang team fixes that <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="210910827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210910827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210910827">(Sep 22 2020 at 18:16)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116155">Jake Goulding</span> <a href="#narrow/stream/257204-project-error-handling/topic/dyn.20error.20handling/near/210910679">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="220273">Jane Lusby</span> <a href="#narrow/stream/257204-project-error-handling/topic/dyn.20error.20handling/near/210910506">said</a>:</p>
<blockquote>
<p>I think we should not concern ourselves with <code>try</code> blocks at all</p>
</blockquote>
<p>I'd disagree, mostly because I think that <code>try</code>, as part of the language, should be considered as much as <code>match</code> or <code>if let</code> or <code>?</code> in regards to errors.</p>
</blockquote>
<p>I feel like <code>try</code> and <code>?</code> are related but neither of those are related to <code>match</code> or <code>if let</code>, which I'd more closely relate to <code>downcast</code> and equality / comparison traits.</p>



<a name="210910921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210910921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jake Goulding <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210910921">(Sep 22 2020 at 18:17)</a>:</h4>
<p>but since it's (a) unstable and (b) the lang team's area, _this_ team is at best a slightly-more-knowledgable participant to those discussions.</p>



<a name="210911046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210911046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210911046">(Sep 22 2020 at 18:18)</a>:</h4>
<p>yea, I encourage participants in this project group to also participate in lang team discussions about try blocks and such, just know that we won't focus on that in <em>our</em> meetings or issues</p>



<a name="210911911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210911911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210911911">(Sep 22 2020 at 18:25)</a>:</h4>
<p>Not to be overly pedantic but <code>not be involved in managing design discussions</code><br>
could be revised to read <code>not be involved in discussions</code></p>



<a name="210913912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257204-project-error-handling/topic/dyn%20error%20handling/near/210913912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jane Lusby <a href="https://rust-lang.github.io/zulip_archive/stream/257204-project-error-handling/topic/dyn.20error.20handling.html#210913912">(Sep 22 2020 at 18:41)</a>:</h4>
<p>i think I'd prefer to leave the wording as is, "not involved in managing design discussions" as in not tracking work with issues in our repo, not having zulip threads focused on it, and not having it on the agenda, but separately members can and are encouraged to be involved in those discussions under the management of the lang team.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>